package admin

import (
	"github.com/google/uuid"
)

type GetLLMMessagesRequest struct {
	ConversationID string `query:"conversation_id" validate:"omitempty,uuid"`
	Page           int    `query:"page" validate:"omitempty,min=1"`
	Limit          int    `query:"limit" validate:"omitempty,min=1,max=100"`
}

type GetLLMMessagesResponse struct {
	Rows       []LLMMessageRow `json:"rows"`
	Total      int64           `json:"total"`
	Page       int             `json:"page"`
	Limit      int             `json:"limit"`
	TotalPages int64           `json:"total_pages"`
}

type LLMMessageRow struct {
	ID             uuid.UUID `json:"id"`
	ConversationID uuid.UUID `json:"conversation_id"`
	Role           string    `json:"role"`
	Content        string    `json:"content"`
	CreatedAt      int64     `json:"created_at"`
	// 新增的调试字段
	FinishReason     *string `json:"finish_reason,omitempty"`
	Model            *string `json:"model,omitempty"`
	PromptTokens     *int    `json:"prompt_tokens,omitempty"`
	CompletionTokens *int    `json:"completion_tokens,omitempty"`
	TotalTokens      *int    `json:"total_tokens,omitempty"`
	ProcessingTimeMs *int64  `json:"processing_time_ms,omitempty"`
}

type GetLLMMessageDetailRequest struct {
	MessageID string `param:"id" validate:"required,uuid"`
}

// LLMMessageDetail 包含完整调试信息的LLM消息详情
type LLMMessageDetail struct {
	LLMMessageRow
	RawRequestBody  string `json:"raw_request_body,omitempty"`
	RawResponseBody string `json:"raw_response_body,omitempty"`
}
